'By pass MS Outlook to send email

'Load code into VB. The enter from email address, to email address, (optional) CC email, Subject, Body of email, and (optional) attachment, into sub function at Call Send_BATCH_Mail.

Public Function Send_BATCH_Mail(FromEmail, SendTo, CCTo, Subject, Body, Attachment)

'***************************************************************************************************

'   This Function Is Created in order to solve the Ms-Outlook problem which

'   Prompt users confirmation during Batch e-mail process. The source of the problem is

'   the Microsoft security Update

'***************************************************************************************************

 

'  test To Use CDO (Microsoft's Collaboration Data Objects )  instead of outlook object

   Dim imsg, iconf

   

   Set imsg = CreateObject("CDO.Message")

   Set iconf = CreateObject("CDO.Configuration")

 

 

     If Attachment <> "" Then ' Include attachment if applicable.

    

            'Set myAttachments = objMail.Attachments

             imsg.AddAttachment Attachment

 

            'myAttachments.Add Attachment, olByValue, 1, "Candidate Activity Report"

        End If

   imsg.From = FromEmail

   imsg.To = SendTo

   imsg.CC = CCTo

   imsg.Subject = Subject

   imsg.TextBody = Body

 

 

   iconf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 25

   iconf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = 'enter smtp server here

   iconf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 'enter server port here 

   iconf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0

   iconf.Fields.Update

 

   Set imsg.Configuration = iconf

   imsg.Send

    

End Function

_____________________________________________________________________________________________________________________
Private Sub Command2_Click()
'For those that did not read the instructions
Call Send_BATCH_Mail("sendersemail@server.com", "toemail@server.com", "ccemail@server.com", "Subject", "Body of Message", "Optional attachment filename and path")

End Sub

